package com.d3works.apps.stock.service;

import com.d3works.apps.base.db.Company;
import com.d3works.apps.base.db.Partner;
import com.d3works.apps.stock.db.PartnerStockSettings;
import com.d3works.apps.stock.db.StockLocation;
import com.d3works.exception.D3worksException;
import com.d3works.meta.CallMethod;

public interface PartnerStockSettingsService {

  /**
   * get the mail settings from the partner and the company, create if not found
   *
   * @param partner
   * @param company
   */
  PartnerStockSettings getOrCreateMailSettings(Partner partner, Company company)
      throws D3worksException;

  /**
   * Create PartnerStockSettings in the given partner
   *
   * @param partner
   * @param company
   */
  PartnerStockSettings createMailSettings(Partner partner, Company company) throws D3worksException;

  /**
   * get default stock location for given partner and company
   *
   * @param partner
   * @param company
   */
  @CallMethod
  public StockLocation getDefaultStockLocation(Partner partner, Company company);

  /**
   * Search for partner stock settings and returns default external default location for given
   * partner and company
   *
   * @param partner
   * @param company
   * @return null if the config is empty, else the found stock location.
   */
  @CallMethod
  StockLocation getDefaultExternalStockLocation(Partner partner, Company company);
}
